package com.superhelper.app.common;

import java.util.HashMap;
import java.util.Map;

/**
 * 项目常量类
 * 
 * @author duanshao
 * 
 */
public interface Consts {

    String UTF8 = "utf-8";
    String PRODUCES = "application/json;charset=utf-8";

    Map<Long, String> CODE_CITY = new HashMap<Long, String>();

    String VERIFY_CODE = "verify_code";

    String SESSION_ADMIN = "session_admin";

    String COOKIE_ADMIN = "cookie_admin";
    /** 定义cookie存活时间为1周 */
    int MAX_AGE = 7 * 24 * 60 * 60;
    int DAY_AGE = 24 * 60 * 60;
    int HOURE_TWO = 2 * 60 * 60;

    // redis前缀
    interface Cache {
        // 环信缓存
        String TOKEN = "esportsc_hx_token";
        String ELEME_TOKEN = "super_helper_eleme_token_";
        String SUPER_SHOP = "super_helper_shop_";
        String MT_TOKEN = "super_helper_mt_token_";
        String USER_TOKEN_KEY = "super_user_token_key_";
        String USER_LOGIN_PREFIX = "super_user_login_key_";
        String SMS_NORECEIVER_KEY = "super_sms_noreceiver_";
        String SMS_REFUNDING_KEY = "super_sms_refund_";
    }

    interface Key {
        String SIGN = "123456";
    }

    // 通用状态码
    interface Code {

        /** 公用的返回码 */
        // 成功
        int SUCCESS = 0;
        // 失败
        int FAIL = -1;
        // 签名错误
        int SIGN_ERROR = 1;
        // 网络链接错误
        int NET_CONN_ERROR = 2;

        // 安全错误
        int SECURE_ERROR = 3;
        // 内部错误,发生异常等
        int INTERNAL_ERROR = 4;
        // 参数错误
        int DATA_ERROR = 5;
        // 请求错误，参数不足
        int REQ_ERROR = 6;
        // 业务信息错误
        int APP_INFO_ERROR = 7;
        // 数据不存在
        int DATA_NO_FOUND = 8;
        // 网络响应错误
        int NET_READ_ERROR = 9;

        // 用户注册
        // 手机号已注册
        int USER_PHONE_EXISTS = 100;
        // 手机号不存在
        int USER_NOT_EXISTS = 101;
        // 验证码码无效
        int VERIFY_CODE_INVALID = 102;
        int USER_LOGIN_FORBIDDEN = 103;
        // 账号过期
        int USER_EXPIRE = 104;
        int PAY_PAYED = 200; // 支付完成
        int PAY_UNPAY = 201; // 未支付

    }

    // 表分区的数量
    interface TablePartition {
        int USER = 8;
        int ALBUM = 8;
        int FRIENDSHIP = 8;
        int INTRO = 8;
        int DISCUSSION_MEMBER = 8;
        int REPLY = 4;
        int POSTS = 34;
        int POSTS_ALBUM = 34;
        int COMMENTS = 8;
    }

    // 环信请求方法
    interface HTTPMethod {
        String METHOD_GET = "GET";
        String METHOD_POST = "POST";
        String METHOD_PUT = "PUT";
        String METHOD_DELETE = "DELETE";
    }

    interface Roles {
        /** USER_ROLE_ORGADMIN value: orgAdmin */
        public static String USER_ROLE_ORGADMIN = "orgAdmin";

        /** USER_ROLE_APPADMIN value: appAdmin */
        public static String USER_ROLE_APPADMIN = "appAdmin";

        /** USER_ROLE_IMUSER value: imUser */
        public static String USER_ROLE_IMUSER = "imUser";
    }

    /** Cookie */
    interface Cookies {
        /** 定义cookie名字 */
        static final String COOKIE_ADMIN = "cookie_admin";
        /** 定义验证码保存在session的字符串 */
        static final String VERIFY_CODE = "verify_code";
        /** 定义cookie存活时间为: 一周 */
        static final int COOKIE_MAX_AGE = 7 * 24 * 60 * 60;
    }

    /**
     * 推送信息类型
     */
    interface MsgType {
        String TEXT = "txt";
        String IMG = "img";
        String AUDIO = "audio";
        String VIDEO = "video";
        String POSTS = "posts";
    }

    /**
     * 应用消息订阅标识（小米）
     */
    interface AppPush {
        String XM_ALL_IOS_USER = "xm_esports_subscription_ios";
        String XM_ALL_ANDROID_USER = "xm_esports_subscription_android";

        String XM_ALL_IOS_USER_TEST = "xm_esports_subscription_ios_test";
        String XM_ALL_ANDROID_USER_TEST = "xm_esports_subscription_android_test";
    }

    /**
     * 业务订单相关的状态
     */
    interface OrderState {

        /**
         * 未支付
         */
        int UNPAY = 0;
        /**
         * 已取消
         */
        int CANCELED = 50;
        /**
         * 支付异常
         */
        int PAY_ERROR = 100;
        /**
         * 支付失败
         */
        int PAY_FAIL = 120;
        /**
         * 支付部分
         */
        int PAY_PART = 150;
        /**
         * 订单转正（假设支付完成）
         */
        int PAY_MOCK = 180;
        /**
         * 已支付
         */
        int PAYED = 200;

        /**
         * 支付的后续动作已处理
         */
        int PAY_SURED = 400;

        /**
         * 冲正中
         */
        int REVERSING = 700;
        /**
         * 冲正异常
         */
        int REVERSE_ERROR = 710;
        /**
         * 冲正失败
         */
        int REVERSE_FAIL = 730;
        /**
         * 冲正部分
         */
        int REVERSE_PART = 760;
        /**
         * 冲正成功
         */
        int REVERSED = 790;

        /**
         * 已申请退款
         */
        int REFUND_APPLYED = 810;
        /**
         * 退款申请不通过
         */
        int REFUND_APPLY_UNPASS = 820;
        /**
         * 退款申请通过
         */
        int REFUND_APPLY_PASS = 830;
        /**
         * 退款中
         */
        int REFUNDING = 840;
        /**
         * 退款异常
         */
        int REFUND_ERROR = 850;
        /**
         * 退款失败
         */
        int REFUND_FAIL = 860;
        /**
         * 退款部分
         */
        int REFUND_PART = 870;
        /**
         * 退款成功
         */
        int REFUNDED = 890;
    }

    interface PayType {
        String CASH = "cash";
    }
}
